﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserListN.aspx.cs" Inherits="XYTXL.View.Common.UserListN" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>人员选择</title>
    <link href="/View/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" />
    <link rel="stylesheet" href="/View/CSS/MyClass.css" />
    <script type="text/javascript" src="/View/JS/jquery-1.11.2.min.js"></script>
    <script src="/View/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/View/JS/FTCommon.js"></script>

    <script>
        $(document).ready(function () {
            $(".pCard").click(function () {
                //var $pCard = $(this);
                //$(this).toggle(
                //    function () {
                //        $(this).addClass("pCardSelect").find(".selectimg").show();
                //    },
                //    function () {
                //        $(this).removeClass("pCardSelect").find(".selectimg").hide();

                //    }
                //)
                if ($(this).hasClass("pCardSelect")) {
                    $(this).removeClass("pCardSelect").find(".selectimg").hide();
                }
                else {
                    $(this).addClass("pCardSelect").find(".selectimg").show();
                }
            })

            $(".imgCheck").click(function () {
                var branchcode = "#" + $(this).attr("branchcode");
                if ($(this).attr("checktype") === "选中") {
                    $(this).attr("src", "/View/images/btn_checks.png").attr("checktype", "取消");
                    $(branchcode).find(".pCard").addClass("pCardSelect").find(".selectimg").show();
                }
                else {
                    $(this).attr("src", "/View/images/btn_checkd.png").attr("checktype", "选中");
                    $(branchcode).find(".pCard").removeClass("pCardSelect").find(".selectimg").hide();
                }
            })

            $(".imgCheckAll").click(function () {
                if ($(this).attr("checktype") === "选中") {
                    $(this).attr("src", "/View/images/btn_checks.png").attr("checktype", "取消");
                    $(".imgCheck").attr("checktype", "选中");
                }
                else {
                    $(this).attr("src", "/View/images/btn_checkd.png").attr("checktype", "选中")
                    $(".imgCheck").attr("checktype", "取消");
                }
                $(".imgCheck").trigger("click");
            })
            $('#BM_affix li').click(function () {
                $('#BM_affix li').removeClass('active');
                $(this).addClass('active');
                $("#dvPeople").scrollTop(40)
                var newid = $(this).attr("id").replace("li", "#");
                var bmtop = $(newid).position().top;
                $("#dvPeople").scrollTop(bmtop);
            })




            ComFunJS.initForm();
            $(".Yan_Form").each(function () {
                var usercount = $(this).find(".pCard").length;
                if (usercount != 0) {
                    $(this).find(".formtitle").append("<div style='float:right'><b>共" + usercount + "人</b></div>");
                }
                else {
                    $(this).hide();
                    $("#li" + $(this).attr("id")).hide();
                }
            })

            var selnodes = ComFunJS.getQueryString("checkvalue").split(",");
            for (var i = 0; i < selnodes.length; i++) {
                $(".pCard").each(function() {
                    if ($(this).attr("username") == selnodes[i]) {
                        $(this).addClass("pCardSelect").find(".selectimg").show()
                    }
                })
            }
        })
        function getqiandaopeople() {
            var userid = "";
            var username = "";

            $(".pCardSelect").each(function () {
                userid = userid + $(this).attr("username") + ",";
                username = username + $(this).find(".pName").text() + ",";

            })
            userid = userid.substr(0, userid.length - 1);
            username = username.substr(0, username.length - 1);
            var people = { 'userid': userid, 'username': username };
            return people;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="container" style="padding: 20px">
            <div class="row">
                <div class="col-xs-3" id="myScrollspy">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            所有部门
                                    <img class="imgCheckAll" style="height: 26px; width: 22px; cursor: pointer; float: right" src="/View/images/btn_checkd.png" title="选中或取消该部门人员" checktype="选中" />
                        </div>
                        <div class="panel-body">
                            <ul class="nav nav-pills nav-stacked" style="min-width: 180px" id="BM_affix">
                                <asp:Repeater runat="server" ID="RepBMListCD">
                                    <ItemTemplate>
                                        <li style="cursor: default" class="libumen" id='li<%# Eval("branchcode") %>'><a href="javascript:;"><b class="YanBranchName"><%# Eval("branchcode") %></b>
                                            <img class="imgCheck" branchcode="<%# Eval("branchcode") %>" style="height: 26px; width: 22px; cursor: pointer; float: right" src="/View/images/btn_checkd.png" title="选中或取消该部门人员" checktype="选中" />
                                        </a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="col-xs-9" id="lists">
                    <div class="panel panel-default">
                        <div class="panel-heading">所有人员</div>

                        <div class="panel-body" style="height: 600px; overflow: auto" id="dvPeople">
                            <asp:Repeater runat="server" ID="RepBMList" OnItemDataBound="RepBMList_ItemDataBound">
                                <ItemTemplate>
                                    <div class="Yan_Form" id='<%# Eval("branchcode") %>'>
                                        <div class="formtitle">
                                            <span class="YanBranchName"><%# Eval("branchcode") %></span><asp:HiddenField ID="hidBM" runat="server" Value='<%#Eval("branchcode") %>' />
                                        </div>
                                        <asp:Repeater runat="server" ID="RepRYList">
                                            <ItemTemplate>
                                                <div class="pCard" username="<%# Eval("username") %>">
                                                    <asp:HiddenField ID="hidUserName" runat="server" Value='<%#Eval("username") %>' />
                                                    <img class="pHead" alt="" src="/View/Upload/TX/def.jpg"    onerror="javascript:this.src='/View/../Upload/TX/def.jpg'"/>
                                                    <div class="pName"><b class="YanUserRealName"><%# Eval("username") %></b></div>
                                                    <div class="pStatus"><%# Eval("zhiwu") %></div>
                                                    <span class="notification" style="display: none"></span>
                                                    <img class="selectimg" src="/View/images/pic21.gif" style="display: none" />
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
</html>
